﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DeveloperSite.Master" AutoEventWireup="true" 
    CodeBehind="Suboutcomes.aspx.cs" Inherits="UNDP_Projects.CO.Suboutcomes" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:EntityDataSource ID="SuboutcomesEntityDataSource" runat="server" 
        ConnectionString="name=UNDPEntities" DefaultContainerName="UNDPEntities" 
        EnableFlattening="False" EntitySetName="sub_outcomes" EnableDelete="True" 
        EnableInsert="True" EnableUpdate="True">
    </asp:EntityDataSource>
    
    <div style="height:2em;">
        <div style="float:left;">
            <asp:Label ID="ContextLabel" runat="server" Text="SUB OUTCOMES" CssClass="ContentHead"></asp:Label>
        </div>
        <% if (User.IsInRole("Administrator"))
           { %>
        <div style="float:right;">
            <asp:Button ID="AddSubOutcomeButton" runat="server" Text="Add Sub Outcome" OnClick="AddSubOutcomeButton_Click" />
        </div>
        <% } %>
    </div>

    <% if (User.IsInRole("Administrator"))
       { %>
    <asp:GridView ID="SuboutcomesGridView" runat="server" 
        AutoGenerateColumns="False" DataKeyNames="sub_outcome_id" 
        DataSourceID="SuboutcomesEntityDataSource" CssClass="NewGrid" 
        ShowFooter="True">
        <AlternatingRowStyle CssClass="NewGridAlt" />
        <Columns>
            <asp:BoundField DataField="sub_outcome_id" HeaderText="SUB OUTCOME" 
                SortExpression="sub_outcome_id" HeaderStyle-Wrap="false" >   
            <HeaderStyle Wrap="False"></HeaderStyle>
            </asp:BoundField>
            <asp:TemplateField SortExpression="sub_outcome">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("sub_outcome") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Width="58em" Height="3em" TextMode="MultiLine" 
                        CssClass="MText" Text='<%# Bind("sub_outcome") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemStyle HorizontalAlign="Left" />
            </asp:TemplateField>

            <asp:CommandField ShowEditButton="true" ButtonType="Button" HeaderText="EDIT" />
            <asp:CommandField ShowDeleteButton="true" ButtonType="Button" HeaderText="DELETE" />

        </Columns>
        <FooterStyle CssClass="NewGridFooter" />
    </asp:GridView>
    <% }
       else
       { %>
        <asp:GridView ID="GridView1" runat="server" 
        AutoGenerateColumns="False" DataKeyNames="sub_outcome_id" 
        DataSourceID="SuboutcomesEntityDataSource" CssClass="NewGrid" 
        ShowFooter="True">
        <AlternatingRowStyle CssClass="NewGridAlt" />
        <Columns>
            <asp:BoundField DataField="sub_outcome_id" HeaderText="SUB OUTCOME" 
                SortExpression="sub_outcome_id" HeaderStyle-Wrap="false" >   
            <HeaderStyle Wrap="False"></HeaderStyle>
            </asp:BoundField>
            <asp:TemplateField SortExpression="sub_outcome">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("sub_outcome") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Width="58em" Height="3em" TextMode="MultiLine" 
                        CssClass="MText" Text='<%# Bind("sub_outcome") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemStyle HorizontalAlign="Left" />
            </asp:TemplateField>

        </Columns>
        <FooterStyle CssClass="NewGridFooter" />
    </asp:GridView>
    <% } %>
</asp:Content>
